package cn.edu.gzist.chapter02.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

// 驼峰命名法
@RestController
public class HelloController {
    @Value("${address}")
    private String address;
    // 注入
    @Autowired
    private Environment env;

    @Value("${consumer.username}")
    private String username;
    @RequestMapping("/first")
    public String sayHello() {
        String name = env.getProperty("spring.application.name");
        return "Hello World " + address +"  " + username + "  " +name;
    }
}
